package com.hoshino.momochi.model.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Date;

/**
 * sendId 发送者Id
 * pullId 接收者Id
 * message 消息内容
 * isDelete 是否被删除
 */
@Data
public class Message {
    @TableId(value = "id", type = IdType.AUTO)
//    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Long id;

    @TableField("sendId")
    private Long sendId;

    @TableField("pullId")
    private Long pullId;

    @TableField("message")
    private String messageInfo;

    @TableField("create_time")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @TableField("isDelete")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) // 禁止 序列化
    private int isDelete;

    public Message(Long sendId, Long pullId, String messageInfo) {
        this.sendId = sendId;
        this.pullId = pullId;
        this.messageInfo = messageInfo;
    }

    public Long getSendId() {
        return sendId;
    }

    public void setSendId(Long sendId) {
        this.sendId = sendId;
    }

    public Long getPullId() {
        return pullId;
    }

    public void setPullId(Long pullId) {
        this.pullId = pullId;
    }

    public String getMessageInfo() {
        return messageInfo;
    }

    public void setMessageInfo(String messageInfo) {
        this.messageInfo = messageInfo;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
